package com.buka.dao;

import com.buka.entity.Hotel;
import com.buka.util.JDBCUtil;

import java.time.LocalDateTime;
import java.util.List;

public class HotelDao {

    public List<Hotel> noInList()    {
        //查询未入住的房屋集合
        String sql = "select * from t_hotel";
        return JDBCUtil.executeQuery(sql, Hotel.class);
    }

    public int kf(int roomNum){
        String sql="update t_hotel set status = 1 where roomNum = ?";
        return JDBCUtil.executeUpdateByArr(sql, roomNum);
    }

    public int kf(int roomNum,String personCard){
        LocalDateTime now = LocalDateTime.now();
        String sql="update t_hotel set status = 1,personCard = ?,inTime = ? where roomNum = ?";
        return JDBCUtil.executeUpdateByArr(sql,personCard,now,roomNum);
    }

    public int tf(int roomNum){
        String sql = "update t_hotel set status =0 ,inTime = null ," +
                "personCard = null where roomNum = ?";
        return JDBCUtil.executeUpdateByArr(sql, roomNum);
    }



}
